using BingYing.SAAS.SystemModel.Application.Manager;
using BingYing.SAAS.SystemModel.Contracts.Manager;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Diagnostics;
using System.Security.Principal;
using Volo.Abp.AspNetCore.ExceptionHandling;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.Validation;
using Volo.Abp.DependencyInjection;
using Volo.Abp.EntityFrameworkCore.ChangeTrackers;
using Volo.Abp.Modularity;
using Volo.Abp.Uow;

namespace BingYing.SAAS.SystemModel.WebApi.Controllers
{
    [Authorize("MastLogin")]
    [ApiController]
    [Route("[controller]/[action]")]
    public class WeatherForecastController : AbpControllerBase
    {
        private static readonly string[] Summaries = new[]
        {
            "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
        };
        private readonly IManagerService service;

        public WeatherForecastController(IManagerService service)
        {
            this.service = service;
        }



        [HttpGet]
        public async Task<IEnumerable<WeatherForecast>> Get()
        {
            var services = this.HttpContext.RequestServices;
            var managerService = services.GetService<IManagerService>();
            Console.WriteLine(managerService);

            return Enumerable.Range(1, 5).Select(index => new WeatherForecast
            {
                Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
                TemperatureC = Random.Shared.Next(-20, 55),
                Summary = Summaries[Random.Shared.Next(Summaries.Length)]
            })
            .ToArray();
        }

  
        //[AllowAnonymous]
        //public Task<LoginOutDto> Login(LoginInputDto dto)
        //{
        //    var iss = this.HttpContext.RequestServices.GetRequiredService<IModelStateValidator>();
        //    Console.WriteLine(iss.GetType());
        //    var module = this.HttpContext.RequestServices.GetRequiredService<IModuleContainer>();
        //    Trace.WriteLine(module);
        //    var service = LazyServiceProvider.GetRequiredService<IManagerService>();
        //    return service.LoginUser(dto);
        //}
    }
}
